# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-lmdb
pkgver=0.98
pkgrel=0
pkgdesc="Universal Python binding for the LMDB 'Lightning' Database"
url="https://github.com/jnwatson/py-lmdb/"
arch="all"
license="OLDAP-2.8"
depends="python3"
makedepends="py3-setuptools python3-dev lmdb-dev"
checkdepends="py3-pytest"
source="https://github.com/jnwatson/py-lmdb/archive/py-lmdb_$pkgver.tar.gz"
builddir="$srcdir/py-lmdb-py-lmdb_$pkgver"

case "$CARCH" in
	x86) _arch="i686" ;;
	arm*) _arch="armv8l" ;;
	*) _arch="$CARCH" ;;
esac

build() {
	LMDB_FORCE_SYSTEM=1 python3 setup.py build
}

check() {
	PYTHONPATH="$PWD/build/lib.linux-$_arch-3.8" pytest
}

package() {
	LMDB_FORCE_SYSTEM=1 python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="b3e8ac589d402a14f1ddbd45c51c888660d00336d9a3ae1cee022f45441c2a79311f5e51c4c12aa2f78c3ae00b3ee200a131950e18d15a782bb50ca34dd62c65  py-lmdb_0.98.tar.gz"
